import { instance as request } from '../request'

/**
 * 查询账号
 * @param account
 * @returns
 */
export const searchFriendApi = (account: string): PromiseRes<searchFriendItf> =>
  request.get('/friend/search/' + account)

/**
 * 添加好友
 * @param account 好友账号
 * @returns
 */
export const addFriendApi = (account: string): PromiseRes =>
  request.post('/friend/add', { account })

/**
 * 删除好友
 * @param id  好友id
 * @returns
 */
export const deleteFriendApi = (id: string): PromiseRes =>
  request.delete(`/friend/delete/${id}`)

/**
 * 分页获取关注列表
 * @param type  类型 0 为用户关注好友  1为用户粉丝好友
 * @param page  页码
 * @param pageSize  分页大小
 * @returns
 */
export const getFriendListApi = (
  params: getFriendPageListItf
): PromiseRes<getFriendListItf> => request.get(`/friend/list`, { params })

/**
 * 获取好友信息
 * @param id 好友id
 * @returns
 */
export const getFriendInfoApi = (id: string): PromiseRes<getFriendInfoItf> =>
  request.get(`/friend/info/${id}`)
